package com.wt.admin.controller.language;


import com.aizuda.easy.security.domain.Rep;
import com.aizuda.easy.security.domain.Req;
import com.wt.admin.config.aspect.annotation.LogAno;
import com.wt.admin.domain.dto.language.SentenceDTO;
import com.wt.admin.domain.vo.language.ClassTaggingVO;
import com.wt.admin.domain.vo.language.SentenceVO;
import com.wt.admin.domain.vo.sys.UserVO;
import com.wt.admin.service.language.LanguageProxyService;
import com.wt.admin.util.PageUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("tagging")
public class TaggingController {

    @Resource
    private LanguageProxyService languageProxyService;

    @LogAno(name = "添加语句")
    @PostMapping("add")
    public Rep<SentenceVO> add(@RequestBody Req<SentenceDTO, UserVO> req){
        return Rep.ok(languageProxyService.getTaggingService().add(req.getData()));
    }

    @LogAno(name = "语句列表")
    @PostMapping("list")
    public Rep<ClassTaggingVO> list(@RequestBody Req<PageUtil.PageDTO<SentenceDTO>, UserVO> req){
        ClassTaggingVO classTaggingVO = languageProxyService.taggingList(req.getData());
        return Rep.ok(classTaggingVO);
    }

    @LogAno(name = "删除语句")
    @PostMapping("del")
    public Rep<SentenceVO> del(@RequestBody Req<SentenceDTO, UserVO> req){
        return Rep.ok(languageProxyService.getTaggingService().del(req.getData()));
    }

    @LogAno(name = "编辑语句")
    @PostMapping("edit")
    public Rep<SentenceVO> edit(@RequestBody Req<SentenceDTO, UserVO> req){
        return Rep.ok(languageProxyService.getTaggingService().edit(req.getData()));
    }

}
